<?php

namespace Drupal\shusy_point_product\MetadataController;

use EntityDefaultMetadataController;

class ShusyPointProductOrderMetadataController extends EntityDefaultMetadataController {

  public function entityPropertyInfo() {
    $info = parent::entityPropertyInfo();
    $properties = &$info[$this->type]['properties'];
    $properties['user'] = [
      'label' => t('所有人'),
      'type' => 'user',
      'schema field' => 'uid',
      'description' => t('所有人.'),
    ];
    $properties['op_user'] = [
      'label' => t('操作人'),
      'type' => 'user',
      'schema field' => 'op_uid',
      'description' => t('操作人.'),
    ];

    $properties['created'] = [
      'label' => t('记录时间'),
      'type' => 'date',
      'schema field' => 'created',
      'description' => t('记录时间.'),
    ];
    $properties['changed'] = [
      'label' => t('变化时间'),
      'type' => 'date',
      'schema field' => 'changed',
      'description' => t('变化时间.'),
    ];

    $properties['weight'] = [
      'label' => t('产品重量(克)'),
      'type' => 'integer',
      'description' => t('产品重量(克),已自动转换单位,仅保留整数'),
      'getter callback' => 'entity_property_getter_method',
    ];
    $properties['product'] = [
      'label' => t('产品'),
      'type' => 'shusy_point_product',
      'schema field' => 'point_product_id',
      'description' => t('产品.'),
    ];
    $properties['express'] = [
      'label' => t('快递类型'),
      'type' => 'shusy_express_type',
      'schema field' => 'express_type_id',
      'description' => t('快递类型.'),
    ];

    return $info;
  }
}
